package org.apache.http.examples.client;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.fluent.Form;
import org.apache.http.client.fluent.Request;

public class FluentQuickStart {
    public static void main(String[] args) {
        // The fluent API relieves the user from having to deal with manual
        // deallocation of system
        // resources at the cost of having to buffer response content in memory
        // in some cases.

        try {
            System.out.println(Request.Get("http://www.baidu.com").execute().returnContent());
//            Request.Post("http://www.baidu.com")
//                    .bodyForm(
//                            Form.form().add("username", "vip")
//                                    .add("password", "secret").build())
//                    .execute().returnContent();
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
}
